import request from "@/utils/request";

function page(current, size, applicantName,approverName,approvalStatus,semesterId,week) {
    return request({
        method: 'GET',
        url: '/classroom_application/page',
        params: {
            current: current,
            size: size,
            applicantName: applicantName,
            approverName: approverName,
            approvalStatus: approvalStatus,
            semesterId: semesterId,
            week: week,
        }
    });
}

function page_by_id(applicantId, current, size, approverName, approvalStatus, semesterId, week) {
    return request({
        method: 'GET',
        url: '/classroom_application/page_by_applicant_id',
        params: {
            applicantId: applicantId,
            current: current,
            size: size,
            approverName:approverName,
            approvalStatus:approvalStatus,
            semesterId:semesterId,
            week:week
        }
    });
}

function add(week, session, reason, classroomId, applicantId, semesterId, dayOfWeek){
    return request({
        method: 'POST',
        url: '/classroom_application',
        data: {
            week:week,
            session:session,
            reason:reason,
            classroomId:classroomId,
            applicantId:applicantId,
            semesterId:semesterId,
            dayOfWeek:dayOfWeek
        }
    });
}

function edit(id, week, session, reason, classroomId, applicantId, semesterId, dayOfWeek){
    return request({
        method: 'PUT',
        url: '/classroom_application',
        data: {
            id:id,
            week:week,
            session:session,
            reason:reason,
            classroomId:classroomId,
            applicantId:applicantId,
            semesterId:semesterId,
            dayOfWeek:dayOfWeek
        }
    });
}

function del(id){
    return request({
        method: 'DELETE',
        url: `/classroom_application/${id}`,
    });
}

export default {
    page,
    page_by_id,
    add,
    edit,
    del
}